package me.szlx.validation;

public abstract class Assert {
    public static void notNull(Object object, String message) {
        if (object == null) {
            throw new IllegalArgumentException(message);
        }
    }

    public static void notNullOrEmpty(String object, String message){
        if (object == null || "".equals(object)) {
            throw new IllegalArgumentException(message);
        }
    }

    public static void constraintNotNull(String constraintCodeOrBrief) {
        notNullOrEmpty(constraintCodeOrBrief, "校验约束编码或消息不能为空");
    }

    public static void constraintNotNull(Constraint constraint) {
        notNull(constraint, "校验约束不能为空");
    }

    public static void conditionalNotNull(Conditional conditional) {
        notNull(conditional, "校验违规检测条件不能为空");
    }
}
